home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / asppw112 / renamedi.asp < prev    next >
Encoding:
Text File  |  1999-01-07  |  1.5 KB  |  52 lines

  1. <HTML><BODY>
  2. <%
  3.     ' Method: RenameDir(strOrginalDirectory, strNewDirectory)
  4.     '
  5.     ' Sample Operation:
  6.     ' Rename DirOrg to be DirNew.
  7.     '
  8.     ' This file is provided as part of  ASP Power Widgets Samples
  9.     '
  10.     ' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT
  11.     ' WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
  12.     ' INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
  13.     ' OF MERCHANTABILITY AND/OR FITNESS FOR A  PARTICULAR
  14.     ' PURPOSE.
  15.  
  16.     ' Copyright 1997-1998. All rights reserved.
  17.     ' Dalun Software Inc. ASP Power Widgets
  18.     ' http://www.dalun.com
  19.     ' http://members.tripod.com/ActiveServerPage/
  20.  
  21.  
  22.     sDirOrg   = "DirOrg"
  23.     sDirNew   = "DirNew"
  24.     sDirOrg   = Server.MapPath("/") & "\" & sDirOrg
  25.     sDirNew   = Server.MapPath("/") & "\" & sDirNew
  26.  
  27.     response.write "Directory " & chr(34) & sDirOrg & chr(34) & _
  28.                    " will be renamed as " & chr(34) & sDirNew & chr(34) & ".<br>"
  29.      
  30.     Set oFDMgt   = Server.CreateObject("ASPPW.FDMgt")
  31.     iReturnCode  = oFDMgt.RenameDir (sDirOrg, sDirNew)
  32.  
  33.     select case iReturnCode
  34.         case    1:  response.write "Operation succeeds.<br>"
  35.         case    0:  response.write "Operation failed since "& chr(34) & sDirOrg &chr(34) &" was not found."
  36.         case   -1:  response.write "Operation failed."
  37.         case else:  
  38.     end select
  39.  
  40.     if oFDMgt.GetLastErrNum <> 0 then
  41.        response.write "<br>Error: " & oFDMgt.GetLastErrDescription
  42.     end if
  43.     
  44.     Set oFDMgt   = nothing
  45. %>
  46. </BODY></HTML>
  47.  
  48.  
  49.  
  50.  
  51.  
  52.